package com.shuoyue.adven.view;


import android.app.Dialog;
import android.content.Context;

import androidx.annotation.NonNull;

import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.TextView;

import com.shuoyue.adven.R;


/**
 * 提示框Dialog
 * Created by Forty'7 on 2019/8/17
 */

public class DownloadingDialog extends Dialog {
    private TextView tvTitel;
    private TextView tvContent;

    public DownloadingDialog(@NonNull Context context, String title, String content) {
        super(context, R.style.dialog);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.dialog_hint);
        getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

        tvTitel = findViewById(R.id.tv_title);
        tvContent = findViewById(R.id.tv_content);

        tvTitel.setText(title);
        if (content != null)
            tvContent.setText(content);

        if (TextUtils.isEmpty(title)) {
            tvTitel.setVisibility(View.GONE);
        }
        if (TextUtils.isEmpty(content)) {
            tvContent.setVisibility(View.GONE);
        }
    }

    public void setContent(String content) {
        tvContent.setText(content);
    }
}
